package com.itheima.homework1.demo4;

public class Computer implements  USB{

    public void use(Computer computer){
        computer.connect();
        computer.exit();
        if(computer instanceof KeyBoard){
            KeyBoard keyboard = (KeyBoard) computer;
            keyboard.input();
        }else if (computer instanceof Mouse){
            Mouse mouse = (Mouse) computer;
            mouse.click();
        }
    }

    @Override
    public void connect() {
        System.out.println("电脑已经连接...");
    }

    @Override
    public void exit() {
        System.out.println("电脑已经断开...");
    }
}
